package com.warmheart.core.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @ClassName: PlatEnum
 * @Description: 平台公用枚举
 * @author hqkj
 * @date 2025-06-16 09:37:02
 *
 */
public class PlatEnum {

    /**
     * 
     * @ClassName: TOPIC
     * @Description: Topic枚举，用于区分不同的微服务
     * @author hqkj
     * @date 2025-06-16 09:37:02
     *
     */
    public enum RedisPrefix {

        PREFIX_CACHE("REDIS_CACHE_", "平台缓存"), PREFIX_WEB("REDIS_WEB_", "WEB端系统缓存"), PREFIX_APP("REDIS_APP_", "APP端系统缓存"), PREFIX_TASK(
                "REDIS_TASK_", "任务微服务缓存");

        private static final Map<String, RedisPrefix> map = new HashMap<String, RedisPrefix>();

        static {
            for (RedisPrefix obj : RedisPrefix.values()) {
                map.put(obj.value, obj);
            }
        }

        // 枚举值
        private String value;

        // 描述
        private String desc;

        private RedisPrefix(String value, String desc) {
            this.value = value;
            this.desc = desc;
        }

        public static RedisPrefix fromString(String valueStr, RedisPrefix... defaultEnum) {
            RedisPrefix obj = map.get(valueStr);
            if (obj == null && defaultEnum != null && defaultEnum.length > 0)
                return defaultEnum[0];
            return obj;
        }

        public String getValue() {
            return value;
        }

        public String getDesc() {
            return desc;
        }
    }

    /**
     * @ClassName: SysConfig
     * @Description: 系统配置信息
     * @author GeLongZhou
     * @date 2025-06-16 09:37:02
     *
     */
    public enum SysConfigEnum {
        MESSAGE_SET("message_set", "消息设置"), PRIVACY_SET("privacy_set", "隐私设置"), DEFAULT_AVATAR_SET(
                "default_avatar_set", "默认头像设置");

        private static final Map<String, SysConfigEnum> map = new HashMap<String, SysConfigEnum>();

        static {
            for (SysConfigEnum obj : SysConfigEnum.values()) {
                map.put(obj.value, obj);
            }
        }

        public String value;

        public String desc;

        private SysConfigEnum(String value, String desc) {
            this.value = value;
            this.desc = desc;
        }

        public static SysConfigEnum fromString(String valueStr, SysConfigEnum... defaultEnum) {
            SysConfigEnum obj = map.get(valueStr);
            if (obj == null && defaultEnum != null && defaultEnum.length > 0)
                return defaultEnum[0];
            return obj;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 
     * @ClassName: MobileMsgTypeEnum
     * @Description: 手机短信类型枚举类
     * @author ZhangJianyang
     * @date 2025-06-16 09:37:02
     *
     */
    public enum MobileMsgTypeEnum {
        REGISTER_USER_MSG("REGISTER_USER_MSG", "注册用户消息"), MODIFY_MOBILE_MSG("MODIFY_MOBILE_MSG", "修改手机号消息");

        private static final Map<String, MobileMsgTypeEnum> map = new HashMap<String, MobileMsgTypeEnum>();

        static {
            for (MobileMsgTypeEnum obj : MobileMsgTypeEnum.values()) {
                map.put(obj.value, obj);
            }
        }

        public String value;

        public String desc;

        private MobileMsgTypeEnum(String value, String desc) {
            this.value = value;
            this.desc = desc;
        }

        public static MobileMsgTypeEnum fromString(String valueStr, MobileMsgTypeEnum... defaultEnum) {
            MobileMsgTypeEnum obj = map.get(valueStr);
            if (obj == null && defaultEnum != null && defaultEnum.length > 0)
                return defaultEnum[0];
            return obj;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 字符集
     * 
     * @author hqkj
     */
    public enum CharEncoding {
        UTF_8("UTF_8", "UTF_8"), UTF_16("UTF_16", "UTF_16"), GBK("GBK", "GBK"), GB2312("GB2312", "GB2312"), ISO8859_1(
                "ISO8859_1", "ISO8859_1");

        private static final Map<String, CharEncoding> map = new HashMap<String, CharEncoding>();

        static {
            for (CharEncoding obj : CharEncoding.values()) {
                map.put(obj.value, obj);
            }
        }

        public String key;

        public String value;

        private CharEncoding(String key, String value) {
            this.key = key;
            this.value = value;
        }

        public static CharEncoding fromString(String valueStr, CharEncoding... defaultEnum) {
            CharEncoding obj = map.get(valueStr);
            if (obj == null && defaultEnum != null && defaultEnum.length > 0)
                return defaultEnum[0];
            return obj;
        }

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }
}
